<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('工程文件上传列表')" />
    <link rel="stylesheet" href="../../../../../../../../../../../../css/navigation.css">
</head>
<body class="gray-bg">
<div class="navigation visible-xs-block">
    <ol class="breadcrumb">
        <span> > </span>
        <li><a href="#" onclick="gomain()">主页</a></li>
        <li style="color: black">工程文件</li>
    </ol>
    <div class="aLine"></div>
</div>
<div class="container-div">
    <div class="row">
        <div class="col-sm-12 search-collapse">
            <form id="formId">
                <div class="select-list">
                    <ul>
                        <li hidden>
                            <label>文件名称：</label>
                            <input type="text" name="pFileName"/>
                        </li>
                        <li hidden>
                            <label>文件类型：</label>
                            <select name="pFileType" th:with="type=${@dict.getType('')}">
                                <option value="">所有</option>
                                <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                            </select>
                        </li>
                        <li hidden>
                            <label>上传文件：</label>
                            <input type="text" name="pFileUploading"/>
                        </li>
                        <li hidden>
                            <label>文件备注：</label>
                            <input type="text" name="pFileRemark"/>
                        </li>
                        <li hidden>
                            <label>上传人：</label>
                            <input type="text" name="pTheHeir"/>
                        </li>
<!--                        <li class="select-time" hidden>-->
<!--                            <label>文件上传时间：</label>-->
<!--                            <input type="text" class="time-input" id="startTime" placeholder="开始时间" name="params[beginPFileTime]"/>-->
<!--                            <span>-</span>-->
<!--                            <input type="text" class="time-input" id="endTime" placeholder="结束时间" name="params[endPFileTime]"/>-->
<!--                        </li>-->
                        <li>
                            <label>项目名称：</label>
                            <input type="text" name="pName"/>
                        </li>
                        <li class="select-time">
                            <label>创建时间：</label>
                            <input type="text" class="time-input" id="startTime" placeholder="开始时间" name="params[beginPTime]"/>
                            <span>-</span>
                            <input type="text" class="time-input" id="endTime" placeholder="结束时间" name="params[endPTime]"/>
                        </li>
                        <li>
                            <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
                            <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
                        </li>
                    </ul>
                </div>
            </form>
        </div>
        <div class="btn-group-sm" id="toolbar" role="group">
            <!--                <a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="system:salary:add">-->
            <!--                    <i class="fa fa-plus"></i> 添加-->
            <!--                </a>-->
            <!--                <a class="btn btn-primary single disabled" onclick="$.operate.edit()" shiro:hasPermission="system:salary:edit">-->
            <!--                    <i class="fa fa-edit"></i> 修改-->
            <!--                </a>-->
            <!--                <a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="system:salary:remove">-->
            <!--                    <i class="fa fa-remove"></i> 删除-->
            <!--                </a>-->
            <a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="system:blueprint:exports">
                <i class="fa fa-download"></i> 导出
            </a>
        </div>
        <div class="col-sm-12 select-table table-striped">
            <table id="bootstrap-table"></table>
        </div>
    </div>
</div>
<th:block th:include="include :: footer" />
<script src="../../../../../../../../../../../../js/breadcrumb.js"></script>
<script th:inline="javascript">
    var removeFlag = [[${@permission.hasPermi('system:blueprint:remove')}]];
    var creadFlag = [[${@permission.hasPermi('system:blueprint:add')}]];
    //工程文件字典类型
    var pFileType = [[${@dict.getType('sys_file_type')}]];
    var prefix = ctx + "system/building";
    var prefixs = ctx + "system/blueprint";

    $(function() {
        var options = {
            url: prefix + "/list",
            createUrl: prefixs + "/add/{id}",
            exportUrl: prefixs + "/exports",
            modalName:"",
            showColumns: false,
            detailView: true,
            mobileResponsive: false,
            cardView: true,
            onExpandRow: function (index, row, $building) {
                initChildTable(index, row, $building);
            },

            columns: [
                {
                    field: 'pId',
                    title: '项目id',
                    visible: false
                },
                {
                    field: 'pName',
                    title: '项目名称'
                },
                {
                    field: 'pTime',
                    title: '项目日期'
                },
                {
                    field: 'pFounder',
                    title: '项目经理'
                },
                {
                    title: '操作',
                    align: 'center',
                    formatter: function(value, row, index) {
                        var actions = [];
                        actions.push('<a class="btn btn-success ' + creadFlag + '" href="javascript:void(0)" onclick="$.operate.add(\'' + row.pId + '\')"><i class="fa fa-add"></i>添加</a> ');
                        return actions.join('');
                    }
                }
            ]
        };
        $.table.init(options);
    });

    initChildTable = function (index, row, $building) {
        var childTable = $building.html('<table style="table-layout:fixed"></table>').find('table');
        $(childTable).bootstrapTable({
            url: prefixs  + "/lists",
            updateUrl: prefixs + "/edit/{pFileId}",
            method: 'post',
            sidePagination: "server",
            contentType: "application/x-www-form-urlencoded",
            queryParams: {
                filePro:row.pId
            },
            columns: [
                {
                    field: 'pFileId',
                    title: '文件id',
                    visible: false
                },
                {
                    field: 'pFileName',
                    title: '文件名称',
                    width: 100,
                },
                {
                    field: 'pFileType',
                    title: '文件类型',
                    width: 100,
                    formatter: function(value, row, index) {
                        return $.table.selectDictLabel(pFileType, value);
                    }
                },
                {
                    field: 'pFileUploading',
                    title: '上传文件',
                    width: 100,
                    formatter: function(value, row, index) {
                        return '<a href="javascript:downloadFile(\''+row.pFileUploading+'\')">下载</a>';
                    }
                },
                {
                    field: 'pFileRemark',
                    title: '文件备注',
                    width: 100,
                },
                {
                    field: 'pTheHeir',
                    title: '上传人',
                    width: 100,
                },
                {
                    field: 'pFileTime',
                    title: '文件上传时间',
                    width: 100,
                },
                {
                    field: 'filePro',
                    title: '项目信息',
                    visible: false

                }

            ]
        });
    };
    function downloadFile(pFileUploading) {
        window.location.href=ctx+"common/download/resource?resource="+pFileUploading;
    }
</script>
</body>
</html>